var AjaxMethod = require("../getAjax.js"); 
var ajax = new  AjaxMethod;
export default{
    state:{
    	formState:{},//用户登录表单,
    	codeData:{}, //验证码表单,
    	loginRes:{}, // 登录结果信息
    },
    mutations:{
    	set_loginList:function(state,{list}){
    		state.loginRes = list;
    	},
    },
    actions:{
    	//登录
		get_login:function(context){//a,b,c,d,e,f,g,h
			var Atype = "post", 
				Aurl = baseUrl+"/members/doLoginH5.html?REQUEST_JSON={visitChannel:2,pageIndex:1,CURRENCY:'CNY',commandInfo:{loginType:4,mobile:"+context.state.formState._uphone+",password:'',smsCode:"+context.state.formState._ucode+",openId:''}}";
			ajax.getJson(Atype,Aurl,function(res){
				console.log(res)
				context.commit("set_loginList",{list:res});
			},function(err){
				console.log(err)
			},function(){
				
			})
		},
		//验证码
		get_code: function(context){
			var Atype = "post", 
			Aurl = baseUrl+'/members/sendRandomSmsCode.html',
			Adata = {
				"send_mobile":context.state.codeData._uphone,
				"type":'1'
			};
			ajax.getJson(Atype,Aurl,Adata,function(res){
				console.log(res)
			},function(err){
				console.log(err)
			},function(){
				context.state.Ajaxing = true; // 加载中显示...
			})
		}	
    }
}